<!DOCTYPE html >
<html>
<head>
    <link rel="stylesheet" href="demos.css" type="text/css" media="screen" />
    
    <script src="../libraries/RGraph.common.core.js" ></script>
    <script src="../libraries/RGraph.common.dynamic.js" ></script>
    <script src="../libraries/RGraph.common.tooltips.js" ></script>
    <script src="../libraries/RGraph.common.effects.js" ></script>
    <script src="../libraries/RGraph.drawing.image.js" ></script>
    <script src="../libraries/RGraph.line.js" ></script>
    
    <title>RGraph demo: The front page line chart (grayscale version) (an old version of the front page)</title>
    
    <meta name="robots" content="noindex,nofollow" />
    <meta name="description" content="The front page line chart" />
     
</head>
<body>

    <!-- Share buttons -->
    <p style="float: right">
        <script>
            document.write('<a href="" target="_blank" onclick="window.open(\'https://www.facebook.com/sharer/sharer.php?u=http://www.rgraph.net' + location.pathname + '\', null, \'top=50,left=50,width=600,height=368\'); return false"><img src="../images/facebook-large.png" width="200" height="43" alt="Share on Facebook" border="0" title="Visit the RGraph Facebook page" id="facebook_link" /></a>&nbsp;');
            document.write('<a href="https://twitter.com/_rgraph" target="_blank" onclick="window.open(\'https://twitter.com/intent/tweet?text=Check%20out%20this%20demo%20of%20RGraph:%202D/3D%20JavaScript%20charts%20-%20Free%20and%20Open%20Source%20http://www.rgraph.net' + location.pathname + '\', null, \'top=50,left=50,width=700,height=400\'); return false"><img src="../images/twitter-large.png" width="200" height="43" alt="Share on Twitter" border="0" title="Mention RGraph on Twitter" id="twitter_link" /></a>');
        </script>
    </p>


    <h1>The line chart from the front page(grayscale version) (an old version of the front page)</h1>

    <canvas id="cvs" width="600" height="300">[No canvas support]</canvas>
    
    <script>
        window.onload = function ()
        {
            var data1 = [4,6,12,16,8,4,2,8,18,16,14,16];
            var data2 = [2,4,8,4,2,6,6,12,8,10,6,8];

            var myLine = new RGraph.Line({
                id: 'cvs',
                data: [data1, data2],
                options: {
                    labels: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
                    tickmarks: null,
                    gutterLeft: 40,
                    gutterRight: 15,
                    gutterBottom: 30,
                    colors: ['#ff0', 'pink'],
                    unitsPost: '%',
                    linewidth: 5,
                    hmargin: 15,
                    textColor: '#333',
                    textFont: 'Arial',
                    shadow: false,
                    backgroundGridAutofitNumvlines: 11,
                    backgroundGridVlines: false,
                    backgroundGridBorder: true,
                    noxaxis: true,
                    title: 'An example Line chart',
                    axisColor: '#666',
                    textColor: '#666',
                    spline: true,
                    textAccessible: true
                }
            }).on('draw', function (obj)
            {
                var pixels = obj.context.getImageData(0,0,obj.canvas.width,obj.canvas.height);

                for (var i=0,len=pixels.data.length; i<len; i+=4) {
                    
                    var avg = (pixels.data[i] + pixels.data[i + 1] + pixels.data[i + 2]) / 3;

                    pixels.data[i] = avg;
                    pixels.data[i + 1] = avg;
                    pixels.data[i + 2] = avg;
                }

                obj.context.putImageData(pixels, 0, 0);
            }).draw();

            /**
            * Use the Trace animation to show the chart
            */
            myLine.set({
                tooltips: [
                    '<b>January</b><br />Started off the year quite averagely',
                    '<b>February</b><br />Better than January, rising quite nicely',
                    '<b>March</b><br />March was quite a spike',
                    '<b>April</b><br />Rising very impressively',
                    '<b>May</b><br />Dropping after the last two month spike',
                    '<b>June</b><br />Still dropping',
                    '<b>July</b><br />The fall is beginning to subside, but still dropping',
                    '<b>August</b><br />A good rise after the fall',
                    '<b>September</b><br />A very good peak',
                    '<b>October</b><br />The peak is now subsiding',
                    '<b>November</b><br />Still subsiding',
                    '<b>December</b><br />Rising again after the last fall',
                    
                    
                    '<b>January</b><br />Started off the year quite averagely as with Robert',
                    '<b>February</b><br />Rising as with Robert',
                    '<b>March</b><br />Not as good as Robert, but OK',
                    '<b>April</b><br />Dropping after the peak',
                    '<b>May</b><br />The low point as with last year',
                    '<b>June</b><br />Rising higher than Robert',
                    '<b>July</b><br />Consistent with last month',
                    '<b>August</b><br />A nice high point',
                    '<b>September</b><br />A low point',
                    '<b>October</b><br />A nice rise',
                    '<b>November</b><br />Falling for fall...',
                    '<b>December</b><br />Rising again for Christmas'
                ]
            })
            .trace2();
        };
    </script>







    <p></p>

    This goes in the documents header:
    <pre class="code">
&lt;script src="RGraph.common.core.js"&gt;&lt;/script&gt;
&lt;script src="RGraph.bar.js"&gt;&lt;/script&gt;
</pre>
    
    Put this where you want the chart to show up:
    <pre class="code">
&lt;canvas id="cvs" width="400" height="200"&gt;
    [No canvas support]
&lt;/canvas&gt;
</pre>

    This is the code that generates the chart:
    <pre class="code">
    window.onload = function ()
    {
        var data1 = [4,6,12,16,8,4,2,8,18,16,14,16];
        var data2 = [2,4,8,4,2,6,6,12,8,10,6,8];

        var myLine = new RGraph.Line({
            id: 'cvs',
            data: [data1, data2],
            options: {
                labels: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
                tickmarks: null,
                gutterLeft: 40,
                gutterRight: 15,
                gutterBottom: 30,
                colors: ['#ff0', 'pink'],
                unitsPost: '%',
                linewidth: 5,
                hmargin: 15,
                textColor: '#333',
                textFont: 'Arial',
                shadow: false,
                backgroundGridAutofitNumvlines: 11,
                backgroundGridVlines: false,
                backgroundGridBorder: true,
                noxaxis: true,
                title: 'An example Line chart',
                axisColor: '#666',
                textColor: '#666',
                spline: true,
                textAccessible: true
            }
        }).on('draw', function (obj)
        {
            var pixels = obj.context.getImageData(0,0,obj.canvas.width,obj.canvas.height);

            for (var i=0,len=pixels.data.length; i&lt;len; i+=4) {
                
                var avg = (pixels.data[i] + pixels.data[i + 1] + pixels.data[i + 2]) / 3;

                pixels.data[i] = avg;
                pixels.data[i + 1] = avg;
                pixels.data[i + 2] = avg;
            }

            obj.context.putImageData(pixels, 0, 0);
        }).draw();

        /**
        * Use the Trace animation to show the chart
        */
        myLine.set({
            tooltips: [
                '<b>January</b><br />Started off the year quite averagely',
                '<b>February</b><br />Better than January, rising quite nicely',
                '<b>March</b><br />March was quite a spike',
                '<b>April</b><br />Rising very impressively',
                '<b>May</b><br />Dropping after the last two month spike',
                '<b>June</b><br />Still dropping',
                '<b>July</b><br />The fall is beginning to subside, but still dropping',
                '<b>August</b><br />A good rise after the fall',
                '<b>September</b><br />A very good peak',
                '<b>October</b><br />The peak is now subsiding',
                '<b>November</b><br />Still subsiding',
                '<b>December</b><br />Rising again after the last fall',
                
                
                '<b>January</b><br />Started off the year quite averagely as with Robert',
                '<b>February</b><br />Rising as with Robert',
                '<b>March</b><br />Not as good as Robert, but OK',
                '<b>April</b><br />Dropping after the peak',
                '<b>May</b><br />The low point as with last year',
                '<b>June</b><br />Rising higher than Robert',
                '<b>July</b><br />Consistent with last month',
                '<b>August</b><br />A nice high point',
                '<b>September</b><br />A low point',
                '<b>October</b><br />A nice rise',
                '<b>November</b><br />Falling for fall...',
                '<b>December</b><br />Rising again for Christmas'
            ]
        })
        .trace2();
    };
&lt;/script&gt;
</pre>



    


    <p>
        <a href="./">&laquo; Back</a>
    </p>

</body>
</html>